﻿

namespace Admin.NET.Core.Btms;
public static class StatusHelper<T>
{
    public static int GetStatusValue(string status)
    {
        var fields = typeof(T).GetFields(
            BindingFlags.Public | BindingFlags.Static);

        foreach (var field in fields)
        {
            if (field.GetValue(null) as string == status)
            {
                var attr = field.GetCustomAttribute<StatusValueAttribute>();
                return attr?.Value ?? 0;
            }
        }
        return 0;
    }
}
